
import '../exception/http_exceptions.dart';

class BaseResponse {
  late bool isSuccess;
  dynamic data;
  HttpException? error;

  BaseResponse._internal({this.isSuccess = false});

  BaseResponse.success(this.data) {
    isSuccess = true;
  }

  BaseResponse.failure({String? errorMsg, int? errorCode}) {
    error = BadRequestException(message: errorMsg, code: errorCode);
    isSuccess = false;
  }

  BaseResponse.failureFromError([HttpException? error]) {
    this.error = error ?? UnknownException();
    isSuccess = false;
  }
}